﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuickGraph;
using EdgeWithAttributes;
namespace EpidemicSimulator.strategies
{
    public class PersentageStateChangePlan : StateChangePlan
    {
        private int persentage;

        public PersentageStateChangePlan(int persentage, StateChangeStrategy strategy)
        {
            this.persentage = persentage;
            this.stateChangeStrategy = strategy;
            this.m_applyTime = 0;
        }

        public PersentageStateChangePlan(int persentage, StateChangeStrategy strategy, long applyTime)
        {
            this.persentage = persentage;
            this.stateChangeStrategy = strategy;
            this.m_applyTime = applyTime;
        }

        public override void applyStrategy(UndirectedGraph<SocialNetworkNode, EdgeWithAttributes<SocialNetworkNode>> socialNetwork, AdjacencyGraph<DiseaseModelNode, DiseaseModelEdge> diseaseModelGraph)
        {
            int numOfUnits = persentage * socialNetwork.VertexCount / 100;
            if (numOfUnits == 0) numOfUnits = 1;
            this.stateChangeStrategy.applyStrategy(socialNetwork, diseaseModelGraph, numOfUnits);
        }
    }
}
